package com.example.teacher.activity;

import android.Manifest;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;

import androidx.annotation.Nullable;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;

import com.example.teacher.R;
import com.trello.rxlifecycle2.components.support.RxAppCompatActivity;

public class LoginActivity extends RxAppCompatActivity {
private LinearLayout student_role_ll;
private LinearLayout teacher_role_ll;
    final int ALL_PERMISSIONS_CODE = 1;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);
        if (ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED
                || ContextCompat.checkSelfPermission(this, Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED|| ContextCompat.checkSelfPermission(this, Manifest.permission.MODIFY_AUDIO_SETTINGS) != PackageManager.PERMISSION_GRANTED) {
            ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.CAMERA, Manifest.permission.RECORD_AUDIO,Manifest.permission.MODIFY_AUDIO_SETTINGS}, ALL_PERMISSIONS_CODE);
        }
        student_role_ll=(LinearLayout)findViewById(R.id.student_role_ll);
        teacher_role_ll=(LinearLayout)findViewById(R.id.teacher_role_ll);
        student_role_ll.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //学生进入考试界面 三个机位
                //MainActivity
                //StudentActivity
                Intent intent=new Intent(LoginActivity.this,MainActivity2.class);
                startActivity(intent);
            }
        });
        teacher_role_ll.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent=new Intent(LoginActivity.this,TeacherInvigilatActivity.class);
                startActivity(intent);

            }
        });
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
    }
}
